package com.shuimutong.paxos.demo.controller;

import com.alibaba.fastjson.JSONObject;
import com.shuimutong.paxos.demo.bean.dto.ReqResult;

public class BaseController {
    public static String ok(Object data) {
        ReqResult res = new ReqResult(data);
        return JSONObject.toJSONString(res);
    }

    public static String paramErr(String msg) {
        ReqResult res = new ReqResult(ReqResult.PARAM_ERR, msg);
        return JSONObject.toJSONString(res);
    }

    public static String sysErr(String msg) {
        ReqResult res = new ReqResult(ReqResult.SYS_ERR, msg);
        return JSONObject.toJSONString(res);
    }
}
